﻿@model CodeStash.Models.Search.CreateSearchViewModel
@using CodeStash.ExtensionsMethods
@{
    ViewBag.Title = "Create Search";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section SpecificPageHeadStuff
 {
    @*@Html.CssTag(Url.Content("~/Content/Controllers/Search/search.css"))*@
    @Html.ScriptTag(Url.Content("~/Scripts/Controllers/Search/search.js"))
}
<div id="dialog-message" style="display: none;">
    <p id="dialog-message-content">
    </p>
</div>
<div id="SearchPanel">
    @using (Html.BeginForm("CreateSearch", "Search", FormMethod.Post, new { id = "CreateSearchForm" }))
    {
     
        @Html.AntiForgeryToken("CreateSearch")
        
        <div id="allFormData">
            <input id="successfulCreate" type="hidden" value="@ViewData["successfulCreate"]" />
            <h2>
                Create Your Search</h2>
            <p>
                You can create your search by choosing and filling one of the sections below, and
                then clicking the submit button, where you will be redirected to the search results.</p>
            <div class="headedPanel">
                <div class="stepPanel">
                    <span>
                        @Html.RadioButtonFor(x => x.SearchType, "ByTag", new { id = "searchType_ByTag" })
                        <label for="searchType_ByTag" class="centerAlignedText">
                            By Tag</label>
                    </span><span>
                        @Html.RadioButtonFor(x => x.SearchType, "ByKeyWord", new { id = "searchType_ByKeyWord" })
                        <label for="searchType_ByKeyWord" class="centerAlignedText">
                            By Keyword</label>
                    </span><span>
                        @Html.RadioButtonFor(x => x.SearchType, "ByLanguage", new { id = "searchType_ByLanguage" })
                        <label for="searchType_ByLanguage" class="centerAlignedText">
                            By Language</label>
                    </span>
                    <br />
                    <br />
                    <strong>Tag</strong>
                    <div>
                        @Html.TextBoxFor((x) => x.SearchForTag, new { @class = "textbox" })
                        &nbsp;
                        @Html.ValidationMessageFor((x) => x.SearchForTag)
                    </div>
                    <br />
                    <strong>Keyword</strong>
                    <div>
                        @Html.TextBoxFor((x) => x.SearchForKeyWord, new { @class = "textbox" })
                        &nbsp;
                        @Html.ValidationMessageFor((x) => x.SearchForKeyWord)
                    </div>
                    <br />
                    <strong>Language</strong>
                    <div>
                        @Html.ComboFor(x => x.LanguageId, x => x.LanguageList, x => x.LanguageId, x => x.Language1,
                            new Dictionary<string, object> { 
                                { "style", "width:400px"}, 
                                { "class", "selectBox"  }})
                        &nbsp;
                        @Html.ValidationMessageFor((x) => x.LanguageId)
                    </div>
                    <br />
                    <strong>Rating</strong>
                    <div>
                        @Html.CheckBoxFor(x => x.IncludeRating, new Dictionary<string, object> { 
                            { "style", "float:left"}})
                        <span class="centerAlignedText">Include Rating</span>
                        <br />
                        <p>
                            <span>Where you would like to see snippets with a rating of at least</span>
                            @Html.ComboFor(x => x.Rating, x => x.RatingList, x => x, x => x,
                     new Dictionary<string, object> { 
                                { "style", "clear:both;width:400px"}, 
                                { "class", "selectBox"  }})
                        </p>
                    </div>
                    @if (User.Identity.IsAuthenticated)
                    {
                        <strong>Visibility</strong>
                        <div>
                            @Html.ComboFor(x => x.Visibility, x => x.VisibilityList, x => x.Id, x => x.VisibilityDescription,
                        new Dictionary<string, object> { 
                            { "style", "width:400px"}, 
                            { "class", "selectBox"  }})
                            &nbsp;
                            @Html.ValidationMessageFor((x) => x.Visibility)
                        </div>
                    }
                    <br />
                    <p>
                        <input id="SearchSubmit" type="button" value="Search" />
                    </p>
                </div>
            </div>
        </div>
 
        <div id="loader" style="display: none">
            @Html.Partial("_Loader")
        </div>
     
    }
</div>
